<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>${_title}</title>

<!-- Bootstrap core CSS -->

<link href="${_css}/bootstrap.min.css" rel="stylesheet">

<link href="${_font}/css/font-awesome.min.css" rel="stylesheet">
<link href="${_css}/animate.min.css" rel="stylesheet">

<!-- Custom styling plus plugins -->
<link href="${_css}/custom.css" rel="stylesheet">
<link href="${_css}/icheck/flat/green.css" rel="stylesheet">
<link href="${_css}/datatables/tools/css/dataTables.tableTools.css"
	rel="stylesheet">
<link rel="stylesheet" href="${_css}/base.css">
<script src="${_js}/jquery.min.js"></script>
<script src="${_js}/resize.js"></script>
<script type="text/javascript" src="${_front_js}/jquery.page.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
<style>
td a {
	cursor: pointer
}
</style>
</head>


<body style="background: #F7F7F7;">
	<div class="">
		<div class="row">
			<div class="col-md-12 col-sm-12 col-xs-12">
				<div class="x_panel">
					<div class="x_title">
						<h2>商品类型列表</h2>
						<div class="clearfix"></div>
					</div>
					<div class="pull-right">
						<button id="add" type="button"
							onclick="javascript:window.location.href='/admin/goodType/addGoodType';"
							class="btn btn-info">新增商品类型</button>
					</div>
					<div class="clearfix"></div>
				</div>
				<div class="scroll">
					<div class="x_content">
						<table id="example" data-action="/admin/goodType/list?1=1"
							class="table table-striped responsive-utilities jambo_table">
							<thead>
								<tr class="headings">
									<th><input type="checkbox" class="tableflat"></th>
									<th>序号</th>
									<th>商品类型名称</th>
									<th>创建时间</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<#if (pageInfo.pageList?size > 0)> 
									<#list pageInfo.pageList as item>
									<tr class="even pointer">
										<td class="a-center "><input type="checkbox" class="tableflat"></td>
										<td>${item_index+1}</td>
										<td>${item.name!}</td>
										<td>${(item.createTime?string("yyyy-MM-dd HH:mm:ss"))!}</td>
										<td>
											<a class="btn-check" data-id="${item.id}" href="/admin/goodType/updateGoodType?id=${item.id}">编辑</a>
											<a href="javascript:;" class="btn-check delete" data-id="${item.id}">删除</a>
										</td>
									</tr>
									</#list> 
								</#if>
							</tbody>
						</table>
						<#if (pageInfo.pageList?size > 0)> <#include "../base/Page.ftl">
						</#if>
					</div>
				</div>
			</div>
			<br />
		</div>
	</div>


	<script src="${_js}/bootstrap.min.js"></script>

<!-- bootstrap progress js -->
<script src="${_js}/progressbar/bootstrap-progressbar.min.js" type="text/javascript"></script>
<script src="${_js}/nicescroll/jquery.nicescroll.min.js" type="text/javascript"></script>
<!-- icheck -->
<script src="${_js}/icheck/icheck.min.js" type="text/javascript"></script>
<script src="${_js}/custom.js" type="text/javascript"></script>

<!-- PNotify -->
<script src="${_js}/notify/pnotify.core.js" type="text/javascript"></script>
<script src="${_js}/notify/pnotify.buttons.js" type="text/javascript"></script>
<script src="${_js}/notify/pnotify.nonblock.js" type="text/javascript" ></script>
<script src="${_front_js}/layer/layer.js" type="text/javascript"></script>
<script>
    $(document).ready(function(){
        $('input.tableflat').iCheck({
            checkboxClass: 'icheckbox_flat-green',
            radioClass: 'iradio_flat-green'
        });
    });
    
    function initData(action) { 
		window.location.href=action;
	} 
	
	$(".delete").click(function(){
		var id = $(this).attr("data-id");
		remove(id);
		
	})
	
	function remove(id){
		layer.confirm('是否确定要删除该类型？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			$.ajax({
			    type: 'POST',
			    dataType: 'JSON',
			    async:'false',
			    headers: {'Content-type': 'application/json;charset=UTF-8'},
			    url: '/admin/goodType/delete?id='+id,
			    success: function(result){
			    if(result.code==-1){
			        layer.alert("删除成功!");
				   window.location.href="/admin/goodType/list";
			    }else{
			        layer.alert(result.msg);       		  	
			    }
		    }
		  })	
		});	
	
	}
</script>
</body>

</html>

</html>